
/**
 * Project Name:cats-core
 * File Name:Resource.java
 * Package Name:com.catsic.core.entity
 * Date:2014年3月17日上午10:14:04
 * Copyright (c) 2014, oa.catsic.com All Rights Reserved.
 */
 
package com.catsic.core.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.catsic.base.BaseEntity;
import com.catsic.base.status.Status;
import com.catsic.pub.entity.Drawer;

/**
 * ClassName: Resource
 * Description: 资源实体类
 * date: 2014年3月17日 上午10:14:04
 * author: yangyd
 */
@Entity
@Table(name="S_RESOURCE")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Resource extends BaseEntity implements Serializable{

	private static final long serialVersionUID = -3231690568535107834L;
	
	/**
	 * 前端页面组件，如：按钮ID等
	 */
	@Column(name="ASSEMBLY")
	private String assembly;
	
	/**
	 * 组件标识需要执行的前端函数，如：js函数等
	 */
	@Column(name="JSFUNCTION")
	private String jsFunction;
	
	/**
	 * 图标
	 */
	@Column(name="ICON")
	private String icon;
	
	/**
	 * pattern:模式
	 */
	@Column(name="PATTERN")
	private String pattern;
	
	/**
	 * views:视图
	 */
	@Column(name="VIEWS")
	private String views;
	
	/**
	 * 节点名称
	 */
	@Column(name="NAME",nullable=false)
	private String name;
		
	/**
	 * CODE:编码
	 */
	@Column(name = "CODE",nullable = false, unique = true)
	private String code;
	
	/**
	 * status:节点状态
	 */
	@Column(name="STATUS",nullable=false)
	@Enumerated(EnumType.STRING)
	private Status status = Status.有效;
	
	/**
	 * 菜单:菜单ID
	 */
	@ManyToOne(optional=false,fetch=FetchType.EAGER)
	@JoinColumn(name="MENUCODE",referencedColumnName = "CODE")
	private Menu menu;
	
	/**
	 * drawer:类型，前端组件：标识需要在前端生成组件，如：生成按钮；公共权限：表示无需生成组件
	 */
	@ManyToOne(fetch = FetchType.EAGER, optional = false)
	@JoinColumn(name = "ACTIONTYPE", referencedColumnName = "CODE")
	private Drawer drawer;
	
	@Column(name="REVENT")
	private String revent;
	
	/**
	 * 功能类型：注：所属功能，具体就是哪个页面上的按钮
	 */
	@ManyToOne(fetch = FetchType.EAGER, optional = false)
	@JoinColumn(name = "AUTHAREACODE", referencedColumnName = "CODE")
	private AuthArea authArea;

	public String getAssembly() {
		return assembly;
	}

	public void setAssembly(String assembly) {
		this.assembly = assembly;
	}
	
	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getJsFunction() {
		return jsFunction;
	}

	public void setJsFunction(String jsFunction) {
		this.jsFunction = jsFunction;
	}

	public String getPattern() {
		return pattern;
	}

	public void setPattern(String pattern) {
		this.pattern = pattern;
	}

	public String getViews() {
		return views;
	}

	public void setViews(String views) {
		this.views = views;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public Menu getMenu() {
		return menu;
	}

	public void setMenu(Menu menu) {
		this.menu = menu;
	}

	public Drawer getDrawer() {
		return drawer;
	}

	public void setDrawer(Drawer drawer) {
		this.drawer = drawer;
	}

	public String getRevent() {
		return revent;
	}

	public void setRevent(String revent) {
		this.revent = revent;
	}

	public AuthArea getAuthArea() {
		return authArea;
	}

	public void setAuthArea(AuthArea authArea) {
		this.authArea = authArea;
	}
}
